<?php require_once('header.php'); ?>
<?php //include_once('topwidget.php'); ?>
<div id="contentBox">
<?php include_once('sidebar.php'); ?>

<!--- query for signup an user to the site -->
<?php
if(isset($_POST['AddCat'])) {
	$cname = $_POST['cname'];
	$cdesc = $_POST['cdesc'];
	
	$addCat = "INSERT INTO categories ( cname, cdesc) VALUES ('$cname', '$cdesc')";
	connection();	
	if(mysql_query($addCat)) {
		success();
	} else {
		failed();
	}
}
?>

<div id="content">
    <div class="form">
    <fieldset>
    	<legend><h1>Add New Category</h1></legend>
        <form action="<?php phpSelf(); ?>" method="post">
            <div class="inputArea">
                <label for="input">Category Name</label>
                <input type="text" name="cname" />
            </div>
            <div class="inputArea">
                <label for="input">Category Description</label>
                <textarea name="cdesc" rows="12"></textarea>
            </div>            
            <div class="inputArea">
            	<label for="input">&nbsp;</label>
                <input class="oBtn inneroBtnPrimary" type="submit" name="AddCat" value="Add Category" />
            </div>
        </form>
        </fieldset>
</div>
<!-- end content in bottom div -->
</div>
<div style="clear:both;"></div>

<?php //include_once('bottomwidget.php'); ?>
<?php include_once('footer.php'); ?>
